#include <iostream>
#include <malloc.h>
#include <math.h>
#include <stdlib.h>
using namespace std;
typedef struct node
{
	char data;
	node *lchild,*rchild;
}BitNode,*BiTree;
BiTree CreatBiTree()
{
	BiTree T;
	char ch;cin>>ch;
	if(ch=='#')
		T=NULL;
	else
	{
		T=(BiTree)malloc(sizeof(BitNode));
		T->data=ch;
		T->lchild=CreatBiTree();
		T->rchild=CreatBiTree();
	}
	return T;
}
int flag=0;
int Chick(BiTree T)
{
	if(flag) return 0;
	int lDepath=0,rDepath=0;
	if(T==NULL) return 0;
	else
	{
		lDepath=Chick(T->lchild);
		rDepath=Chick(T->rchild);
		if(abs(lDepath-rDepath)>1)flag=1;
	}
	return 1+max(lDepath,rDepath);
}
int main()
{
	BiTree T=CreatBiTree();
	Chick(T);
	if(flag) 
		cout<<"no!";
	else
		cout<<"yes!";
	return 0;
}